//
//  ECUFirstHeadCell.m
//  Edu_iOS
//
//  Created by apple on 2017/9/23.
//  Copyright © 2017年 yanyan. All rights reserved.
//

#import "ECUFirstHeadCell.h"
#import "ECUCatalogModel.h"


@interface ECUFirstHeadCell()

@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UIView *lineView;

@end


@implementation ECUFirstHeadCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initCellUI];
    }
    return self;
}

- (void)initCellUI{
    self.selectionStyle = 0;
    self.contentView.backgroundColor = [UIColor colorWithHexString:@"#fafafa"];
    
    _titleLab = [[UILabel alloc]init];
    [self.contentView addSubview:_titleLab];
    _titleLab.textAlignment = NSTextAlignmentLeft;
    _titleLab.textColor = [UIColor colorWithHexString:@"#293039"];
    _titleLab.font = [UIFont systemFontOfSize:48.f*KProportion1080_Heigh];
    
    WeakSelf(weakSelf);
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(48*KProportion1080_Width);
        make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-10);
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.height.mas_equalTo(16);
    }];
    
    _arrowImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_arrowImageView];
    [_arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(weakSelf.contentView.mas_right).offset(-30);
        make.centerY.mas_equalTo(weakSelf.titleLab.mas_centerY);
        make.width.mas_equalTo(36*KProportion1080_Width);
        make.height.mas_equalTo(weakSelf.arrowImageView.mas_width).multipliedBy(20.f/36.f);
    }];
    
    _lineView = [[UIView alloc]init];
    [self.contentView addSubview:_lineView];
    _lineView.backgroundColor = [UIColor colorWithHexString:@"#DEDFE7"];
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf.titleLab.mas_left);
        make.right.mas_equalTo(weakSelf.contentView.mas_right);
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom);
        make.height.mas_equalTo(1);
    }];
    
}

//-(void)setDateOfCellWithModel:(ECUCatalogModel *)model{
//    _titleLab.text = model.text;
//
//    if (model.belowCount == 0) {//折叠
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_downArrow"];
//    }else{
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_upArrow"];
//    }
//
//}
//
//-(void)setArrowIconImageWithModel:(ECUCatalogModel *)model{
//    if (model.belowCount == 0) {//折叠
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_downArrow"];
//    }else{
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_upArrow"];
//    }
//}





//**********************************************************************************************


-(void)setDateOfCellWithModel:(ECListModel *)model{
    _titleLab.text = model.title;
    
//    if (model.belowCount == 0) {//折叠
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_downArrow"];
//    }else{
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_upArrow"];
//    }
}

-(void)setArrowIconImageWithModel:(ECListModel *)model{
//    if (model.belowCount == 0) {//折叠
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_downArrow"];
//    }else{
//        _arrowImageView.image = [UIImage imageNamed:@"catalog_upArrow"];
//    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
